package com.alliance.shuwei.api;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.alliance.shuwei.entity.Company;
import com.alliance.shuwei.service.CompanyService;

@RestController
@RequestMapping("/api/v1/company")
public class CompanyResource {
	private static final Logger logger = LoggerFactory.getLogger(CompanyResource.class);
	@Autowired
	private CompanyService companyService;

	@RequestMapping(method = RequestMethod.GET)
	@ResponseBody
	public Company getCompany() {
		return companyService.getCompany();
	}

	@RequestMapping(method = RequestMethod.POST)
	@ResponseBody
	public Company updateCompany(@RequestBody Company company) {
		companyService.saveCompany(company);
		return company;
	}
}
